<template>
  <div class="pie-echart">
    <baseEchart :options="options"></baseEchart>
  </div>
</template>

<script setup lang="ts">
import { defineProps, computed } from "vue"
import baseEchart from "@/base-ui/echart"
import type { IDataType } from "../types"

// 定义 props 并设置默认值
const props = defineProps<{
  pieData: IDataType[]
}>()

const options = computed(() => {
  return {
    tooltip: {
      trigger: "item"
    },
    legend: {
      orient: "horizontal", //垂直
      bottom: "bottom" //底部
    },
    series: [
      {
        name: "饼图数据",
        type: "pie",
        radius: "50%",
        data: props.pieData,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: "rgba(0, 0, 0, 0.5)"
          }
        }
      }
    ]
  }
})
</script>

<style scoped lang="less"></style>
